CREATE TABLE [dbo].[Production](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[ModelId] [bigint] NOT NULL,
	[Gender] [nvarchar](100) NOT NULL,
	[Date] [datetime] NOT NULL,
	[FabricId] [bigint] NOT NULL,
	[Width] [float] NOT NULL,
	[NumberOfPants] [float] NOT NULL,
	[NumberByProduction] [float] NOT NULL,
	[Average] [float] NOT NULL,
	[DateCreated] [datetime] NOT NULL,
	[CreatedBy] [bigint] NOT NULL,
 CONSTRAINT [PK_Production] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Production]  WITH CHECK ADD FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Users] ([Id])
GO

ALTER TABLE [dbo].[Production]  WITH CHECK ADD FOREIGN KEY([FabricId])
REFERENCES [dbo].[Fabrics] ([Id])
GO

ALTER TABLE [dbo].[Production]  WITH CHECK ADD FOREIGN KEY([ModelId])
REFERENCES [dbo].[Models] ([Id])
GO

ALTER TABLE [dbo].[Production] ADD  CONSTRAINT [DF_Production_DateCreated]  DEFAULT (getdate()) FOR [DateCreated]
GO




INSERT INTO Modules (Id,Name) VALUES (7,'Cortes')

	 
INSERT INTO [Permissions]([Id],[PermissionTypeId],[ModuleId],[CreatedDate])
     VALUES (26,1,7,GETDATE())
INSERT INTO [Permissions]([Id],[PermissionTypeId],[ModuleId],[CreatedDate])
     VALUES (27,2,7,GETDATE())
INSERT INTO [Permissions]([Id],[PermissionTypeId],[ModuleId],[CreatedDate])
     VALUES (28,3,7,GETDATE())
INSERT INTO [Permissions]([Id],[PermissionTypeId],[ModuleId],[CreatedDate])
     VALUES (29,4,7,GETDATE())
	 
INSERT INTO [RolePermissions]([RoleId],[PermissionId],[CreatedDate])
     VALUES(1,26,GETDATE())
INSERT INTO [RolePermissions]([RoleId],[PermissionId],[CreatedDate])
     VALUES(1,27,GETDATE())
INSERT INTO [RolePermissions]([RoleId],[PermissionId],[CreatedDate])
     VALUES(1,28,GETDATE())
INSERT INTO [RolePermissions]([RoleId],[PermissionId],[CreatedDate])
     VALUES(1,29,GETDATE())